const token = 'TOKEN_ITHEIMA'
const channel = 'MY_CHANNELS'
// 本地缓存token
export const setToken = (data) => {
  localStorage.setItem(token, JSON.stringify(data))
}

// 本地获取token
export const getToken = () => {
  return JSON.parse(localStorage.getItem(token))
}

// 移除token
export const removeToken = () => {
  localStorage.removeItem(token)
}

// 本地缓存频道
export const setChannel = (data) => {
  localStorage.setItem(channel, JSON.stringify(data))
}

// 本地获取频道
export const getChannel = () => {
  return JSON.parse(localStorage.getItem(channel))
}
